package com.bella.api.system.controller;

import com.bella.api.system.dto.AdminDto;
import com.bella.api.system.dto.LoginDto;
import com.bella.api.system.service.UserService;
import com.bella.api.utils.ApiResponse;
import com.bella.api.utils.ApiResponseCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zsq
 * @create 2020-05-12-10:05
 */
@Api(description = "用户登录接口")
@RestController
@RequestMapping("/web/common")
public class LoginController {
    @Autowired
    UserService userService;

    @ApiOperation(value = "用户登录", notes = "用户登录")
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public ApiResponse login(@RequestBody LoginDto login) {
        AdminDto adminDto = userService.login(login);
        return new ApiResponse(ApiResponseCode.SUCCESS, adminDto);
    }
}
